import {Route,Switch,Redirect} from 'react-router-dom'
import Main from './Layout';
import Login from './views/Login';
import NotFound from './views/NotFound';
let isLogin = true  //模拟登录状态
function App() {
  return (
    <div className="App">
      <Switch>
        <Route path="/admin" render={()=>{
          if(isLogin){
            return <Main/>
          }
          return <Redirect to="/login"/>
        }}/>
        <Route path="/login" component={Login}/>
        <Route path="/404" component={NotFound}/>
        <Redirect from="/" exact to="/admin"/>
        <Redirect from="*" to="/404"/>
      </Switch>
    </div>
  );
}

export default App;
